﻿using System;
using System.IO;
using Core.IocHelpers;

namespace Core.Infrastructure
{
  ///<summary>Related to .NET</summary>
  [AutoRegister]
  public class Framework : IFramework
  {
    #region IFramework Members

    ///<summary>Verify that we have .NET 3.5</summary>
    ///<returns></returns>
    public bool IsVersion35(out string message)
    {
      var path = Environment.ExpandEnvironmentVariables("%windir%") + @"\Microsoft.NET\Framework\v3.5";
      var folderOkay = Directory.Exists(path);

      message = string.Format(
            "Sorry, .NET Framework 3.5 is required and does not appear to be installed on this computer.\nPath not found: {0}",
            path);

      return folderOkay;
    }

    #endregion
  }

  [AutoRegisterable]
  public interface IFramework
  {
    ///<summary>Verify that we have .NET 3.5</summary>
    ///<returns></returns>
    bool IsVersion35(out string message);
  }
}